import { useNavigate, useLocation } from "react-router-dom";
import "./index.css";

export default function () {
  const history = useNavigate();
  const { pathname } = useLocation();

  const navList = [
    {
      label: "公司介绍",
      path: "/introduction",
    },
    {
      label: "校园招聘",
      path: "/campus",
    },
    {
      label: "了解更多",
      path: "/more",
    },
  ];
  return (
    <div className="headerBox">
      <div className="banner">
        <div className="logo"></div>
        <div className="nav">
          {navList.map((item, index) => {
            return (
              <li
                key={index}
                className={item.path === pathname ? "active" : ""}
                onClick={() => {
                  history(item.path);
                }}
              >
                {item.label}
              </li>
            );
          })}
        </div>
      </div>
    </div>
  );
}
